Repository navigation
fix: 基础用户无每日额度时不再把整张额度卡片弄坏(0.2.45) - #12
Merged
Merged
Conversation
平台自 2026-11-11 起取消基础用户的每日赠送额度(官方公告 https://monkeycode.docs.baizhi.cloud/node/01a012e5-d949-76db-96d0-b9cf63283026), Basic 账号的钱包把 daily_token_limit / daily_token_balance 都下发 0。 - runtime.readUsage:limit = 0 时不再构造数量型窗口(usageWindow 硬要求 limit > 0, 拿 0 去建会抛 QuotaShapeError,把整张卡片连「积分余额」一起弄坏,这个号在路由里 也失去额度读数),退化成文本窗口「平台未发放(基础用户自 2026-11-11 起无每日赠送额度)」 - 专业版 / 期间版按公告仍有日额度,limit > 0 走原路,不受影响 - readUsage 增加 now 透传口:今天消耗按本地日历日算,单测原先用真时钟比 2026-11-09 的 fixture,从 11-10 起恒为 0,两条用例一直红着 - README / registry-entry.json / CHANGELOG:补「基础用户没有日额度」的口径与 FAQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
是什么
平台自 2026-11-11 起取消基础用户的每日赠送额度(官方公告),Basic 账号的钱包把
daily_token_limit与daily_token_balance都下发 0。插件原先只要这两个字段存在就构造「每日额度」数量型窗口,而
src/quota.mjs的构造器硬要求limit > 0⇒ 抛QuotaShapeError⇒ 整个usage()失败:额度卡片整张变错误态(连「积分余额」那条都画不出来),这个号在智能路由里也失去额度读数。实测
curl -s http://127.0.0.1:3425/v1/magpie/quotas,6 个账号(国内 5 + 国际 1,全部 Basic)全部是该错误。改了什么
src/monkeycode/runtime.mjslimit = 0时不再建数量型窗口,退化成文本窗口「平台未发放(基础用户自 2026-11-11 起无每日赠送额度)」(specs/quota.md§10.2 的原话);limit > 0走原路,专业版 / 期间版不受影响。另给readUsage加now透传口tests/monkeycode.test.mjslimit = 0不抛错、额度那条是 textOnly、积分余额照常、至少留一条可路由窗口tests/today-spend.test.mjsREADME.md/registry-entry.json/CHANGELOG.md没改的:模型名后缀仍写「· 每日额度」。实测 basic 账号调
monkeycode-basic/deepseek-flash照样 200,但扣的是积分(38 token 的调用扣 0.011 积分)—— 后缀说明的是「这条属于订阅档位的池、账号有没有权限调」,不是「此刻还有免费额度」,README 里已写清。证据
readUsage直跑:修复前 6/6 抛QuotaShapeError;修复后读出「每日额度 = 文本 + 积分余额 = 37.949 / 71.124 / 340.481」,且各有 1 条可路由窗口node --test→ 411 通过 / 0 失败(修复前 409/2)node scripts/check.mjs→ 通过 49 · 警告 0 · 失败 0;npm pack --dry-run→magpie-monkeycode-0.2.45.tgz,126 个文件node scripts/privacy-scan.mjs --staged→ PASS(0 处)